Skip to content

Show a list of mods required to be enabled or disabled when mod is toggled - #200

Open
dkhex wants to merge 8 commits into
FreesmTeam:developfrom
dkhex:feat_clarify_requirements_for_mod_toggle
Open

Show a list of mods required to be enabled or disabled when mod is toggled#200
dkhex wants to merge 8 commits into
FreesmTeam:developfrom
dkhex:feat_clarify_requirements_for_mod_toggle

Conversation

@dkhex

@dkhex dkhex commented Jul 4, 2026

Copy link
Copy Markdown

A simple QoL addition to "Confirm toggle/enable/disable" MessageBox.

Message example

… mod is toggled

Signed-off-by: dkhex <dk-hex@yandex.ru>
@dkhex

dkhex commented Jul 6, 2026

Copy link
Copy Markdown
Author

I think the mod you wanted to disable is "Sable"

Yes, I disable Sable (in this example), and now can see which mods will be also disabled if I click "Disable Required". And that's how it's looks in Freesm now:

Implicit disable

@fractal-l

Copy link
Copy Markdown
Contributor

lgtm

@notwindstone notwindstone left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the contribution!

@notwindstone
notwindstone requested a review from so5iso4ka July 14, 2026 21:45

@so5iso4ka so5iso4ka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a nice feature, but what if there are too many mods listed in the message? You can't resize this dialog, at least on macOS. Here's what happens:

Image

Perhaps the simplest solution is to limit the number of mods in a string.

@dkhex

dkhex commented Jul 23, 2026

Copy link
Copy Markdown
Author

Okay, how many rows of text is acceptable for a QMessageBox? Or, maybe (if I don't be a lazy ass) I'll try to turn it into custom widget with scrollable list of affected mods.

@fractal-l

Copy link
Copy Markdown
Contributor

That's a nice feature, but what if there are too many mods listed in the message? You can't resize this dialog, at least on macOS. Here's what happens:

Image Perhaps the simplest solution is to limit the number of mods in a string.

QMessageBox has the detailedText property which allows to dialog contain text of any length

@fractal-l

Copy link
Copy Markdown
Contributor

so we can make to show like 5 mods and then "and N more mods..."

@fractal-l fractal-l left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using setDetailedText() or add new constructor: instead of outputting each mod name in message clamp it to first five and add "and N mods more..." in the end
show full list in detailedText

…en mod is toggled

Signed-off-by: dkhex <dk-hex@yandex.ru>
@dkhex

dkhex commented Aug 2, 2026

Copy link
Copy Markdown
Author

Made a custom dialog instead of QMessageBox - resizable window with scrollable list(s) of affected mods.

image

As I understand, right now Freesm using Prism's translation, so in order to not break a translation, I had to make a little hack. Qt l10n design is bullshit.

@so5iso4ka so5iso4ka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix that; other than that, I like everything.

Comment thread launcher/minecraft/mod/ModFolderModel.cpp Outdated
@so5iso4ka so5iso4ka added this to the 2.2.3 milestone Aug 4, 2026
Comment thread launcher/ui/dialogs/ModToggleConfirmDialog.h Outdated
@fractal-l

Copy link
Copy Markdown
Contributor

im not sure that we need these hacks
i will review it tommorow

dkhex added 2 commits August 4, 2026 15:37
Signed-off-by: dkhex <dk-hex@yandex.ru>
Signed-off-by: dkhex <dk-hex@yandex.ru>

@so5iso4ka so5iso4ka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think everything is fine, but I'll wait for @kaeeraa review before merging.

return QString("- %1 (%2)").arg(mod->name(), mod->version());
}

ModToggleConfirmDialog::ModToggleConfirmDialog(QWidget* parent, QSet<Mod*> toEnable, QSet<Mod*> toDisable)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pass QSet by const-reference

Suggested change
ModToggleConfirmDialog::ModToggleConfirmDialog(QWidget* parent, QSet<Mod*> toEnable, QSet<Mod*> toDisable)
ModToggleConfirmDialog::ModToggleConfirmDialog(QWidget* parent, const QSet<Mod*>& toEnable, const QSet<Mod*>& toDisable)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in header too

ui->rejectButton->setIcon(style()->standardIcon(QStyle::SP_DialogCancelButton));
ui->cancelButton->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));

if (toEnable.size() > 0 || toDisable.size() > 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this statement is always true

Suggested change
if (toEnable.size() > 0 || toDisable.size() > 0)
if (toEnable.isEmpty() || toDisable.isEmpty())

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm blind... /)_-


static QString formatMod(Mod* mod)
{
return QString("- %1 (%2)").arg(mod->name(), mod->version());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sadly version can be empty

Suggested change
return QString("- %1 (%2)").arg(mod->name(), mod->version());
if (mod->version().isEmpty()) return QString("- %1").arg(mod->name());
return QString("- %1 (%2)").arg(mod->name(), mod->version());

Comment on lines +111 to +124
void ModToggleConfirmDialog::onAcceptButtonClicked()
{
done(QMessageBox::Yes);
}

void ModToggleConfirmDialog::onRejectButtonClicked()
{
done(QMessageBox::No);
}

void ModToggleConfirmDialog::onCancelButtonClicked()
{
done(QMessageBox::Cancel);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

messed up types (using QMessageBox in QDialog)
consider using QDialog::DialogCode since you don't really need to distinguish reject and cancel buttons

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I need to distinguish "toggle required" and "toggle only selected", so I made own codes.

dkhex added 4 commits August 6, 2026 20:18
Signed-off-by: dkhex <dk-hex@yandex.ru>
Signed-off-by: dkhex <dk-hex@yandex.ru>
Signed-off-by: dkhex <dk-hex@yandex.ru>
Signed-off-by: dkhex <dk-hex@yandex.ru>
@dkhex

dkhex commented Aug 6, 2026

Copy link
Copy Markdown
Author

Thanks for the feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants